<?php 
include '../functions.php';
// 链接数据库
$mysqli = @new mysqli("localhost", "root", "", "school");


if($mysqli->connect_errno){
	exit("错误代码：".$mysqli->connect_errno."错误信息".$mysqli->connect_error);
}


$mysqli->query("set names utf8");




// $sql = "update stu set age=40 where name='小花'";


// $sql = "delete from stu where name ='小马'";

for ($i=0; $i <1000 ; $i++) {
	$sql = "insert into stu (name,age,sex) values('小马".$i."',18,'男');"; 
	$res = $mysqli->query($sql);
}




// if(!$res){
// 	exit("错误代码：".$mysqli->errno."错误信息".$mysqli->error);
// }

// var_dump($res);

$sql = "select * from stu t1 inner join class t2 on t1.cid=t2.cid";


$res = $mysqli->query($sql);


$temArr = [];

while ($row  = $res->fetch_assoc()) {
	$temArr[] = $row;
}


var_dump($temArr);


// $res->free();

// $mysqli->colse();




 ?>